<script>
	function saveLinkageConfig() {
// 		printLog($('#linkageOperations').combogrid("getValues"));
		var  linkageInfo = {
				id:$('#linkageId').val(),
				name:$('#linkageName').val(),
				linkageOperations:$('#linkageOperationsHidden').val()
		};
		printLog(linkageInfo);
		$.post("linkageConfig.do?saveLinkageConfig", linkageInfo, function(result) {
	          if(result.success){
		       	  showMsg('保存成功.');
		       	  reloadLinkageConfig();
	          }else {
	       	  	  showMsg('保存失败.');
	          }
	  	}, "JSON");
	}
	
	function getSelects() {
// 		printLog($('#linkageOperations').combogrid("getValues"));
		$('#linkageOperationsHidden').val($('#linkageOperationsCombogrid').combogrid("getValues"));
	}
</script>
<table cellpadding="5">
	<input id="linkageId" name="id" type="hidden" value="${(linkageConfigItem.id)!}" />
	<tr>
		<td>名称:</td>
		<td>
			<input id="linkageName" name="name"  class="easyui-validatebox" data-options="required: true" value="${(linkageConfigItem.name)!}"/>
		</td>
	</tr>
	<tr>
		<td>
			配置动作:
		</td>
		<td>
<!-- 			<@eu.combogrid id="linkageOperations" url="deviceOperation.do?loadList" name="linkageOperations"  item="com.xdtech.hotel.vo.DeviceOperationItem"/> -->
<!-- 			<input id="linkageOperationsHidden" type="hidden" name="linkageOperations" /> -->
<!-- 			<select id="linkageOperations"  class="easyui-combogrid" style="width:250px" data-options=" -->
<!-- 					panelWidth: 500, -->
<!-- 					multiple: true, -->
<!-- 					idField: 'id', -->
<!-- 					textField: 'name', -->
<!-- 					values:[3,4], -->
<!-- 					url: 'deviceOperation.do?loadListByLinkageId&linkageId=${(linkageConfigItem.id)?default(0)}', -->
<!-- 					method: 'get', -->
<!-- 					columns: [[ -->
<!-- 						{field : 'id',checkbox : true}, -->
<!-- 						{field : 'name',width : 100,title : '动作名称',}, -->
<!-- 						{field : 'type',width : 100,title : '动作类型',formatter : function(value,row, index) {if ((value + '') == '1') {return '动作模式';} else if ((value + '') == '2') {return '场景模式';}},} -->
<!-- 					]], -->
<!-- 					fitColumns: true, -->
<!-- 					onChange : function(a, b) {getSelects()} -->
<!-- 				"> -->
<!-- 			</select> -->
			
			<input id="linkageOperationsCombogrid" name="linkageOperations" value="" />  
			<input id="linkageOperationsHidden" type="hidden" name="linkageOperations" />
			<script type="text/javascript">
			$('#linkageOperationsCombogrid').combogrid({   
			    panelWidth:450, 
			    multiple: true,
				idField: 'id',
				width:250,
				textField: 'name', 
			    url:'deviceOperation.do?loadListByLinkageId&linkageId=${(linkageConfigItem.id)?default(0)}',   
			    columns: [[
							{field : 'id',checkbox : true},
							{field : 'name',width : 100,title : '动作名称',},
							{field : 'type',width : 100,title : '动作类型',formatter : function(value,row, index) {if ((value + '') == '1') {return '动作模式';} else if ((value + '') == '2') {return '场景模式';}},}
						]], 
				onChange : function(a, b) {getSelects()},
				onLoadSuccess:function(data){
// 					printLog(data);
					$('#linkageOperationsCombogrid').combogrid('setValues', data.selects);
				}
			});  

			</script>
		</td>
	</tr>
</table>
